Skip to content

feat: add TypeScript SDK demo app scaffold and Math Standards Alignment evaluator - #132

Merged
adnanrhussain merged 6 commits into
mainfrom
worktree-ahussain+ts_sdk_demo_app
Jul 23, 2026
Merged

feat: add TypeScript SDK demo app scaffold and Math Standards Alignment evaluator#132
adnanrhussain merged 6 commits into
mainfrom
worktree-ahussain+ts_sdk_demo_app

Conversation

@adnanrhussain

@adnanrhussain adnanrhussain commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

What

A minimal web app under demos/typescript/ demonstrating the published @learning-commons/evaluators SDK, structured as two features so more evaluators can be added later:

  1. Demo app scaffold — a runnable Vite + React + Express shell: a home page that lists evaluator demos, client-side routing, and a backend that each evaluator plugs into.
  2. Math Standards Alignment evaluator page — the first evaluator. Pick a grade (K–12) and jurisdiction → searchable multi-select of that grade/jurisdiction's math standards → enter a word problem → Evaluate → view the raw alignment JSON.

Design

  • Stack: React (Vite) + react-router-dom frontend; small Express backend. The SDK is Node-only (top-level node:* imports on the eval path), so all SDK calls run server-side and the browser never sees API keys (Vite proxies /api to the backend).
  • Extensible by construction: evaluator demos are declared in one registry (src/evaluators.tsx) that both the home page and the router consume; the backend exposes GET /api/health and a single call site where each feature registers its routes. Adding an evaluator = a new page + one registry entry + a new 003-… spec, touching nothing else.
  • Math feature endpoints: GET /api/jurisdictions (from the SDK's Jurisdiction enum), GET /api/standards (Knowledge Graph lookup), POST /api/evaluate (MathStandardsAlignmentEvaluator.evaluateItems). If the required keys are absent the routes still mount but return 503, so the scaffold and other evaluators keep working.
  • Server lifecycle: graceful SIGINT/SIGTERM shutdown (server.close + closeAllConnections) so dev-server restarts don't hang or orphan the process.
  • Spec-driven artifacts per feature: specs/001-demo-app-scaffold/ and specs/002-math-standards-alignment/, each with spec.md / plan.md / tasks.md.

SDK gaps surfaced (follow-ups, out of scope here)

  • No public standards-listing helper. KnowledgeGraphClient isn't exported, so server/kg.ts calls the KG REST API directly to populate the picker. A future release should export a getStandardsByGrade-style helper.
  • Peer range too loose. The SDK declares ai >=6.0.0 but is built against ai@7 (@ai-sdk/provider spec v4); installing ai@6 with @ai-sdk/anthropic@4 throws a runtime "Unsupported model version" error. The demo pins ai@^7; the SDK peer should be tightened to ai >=7.

Verification

  • tsc --noEmit clean; vite build clean.
  • Standards lookup verified live against the KG; /api/health and route wiring smoke-tested.
  • Real-key end-to-end run verified via full UI click-through (grade → jurisdiction → standards → word problem → Evaluate → result).
  • Findings from a self code-review and two rounds of Copilot review addressed: stale-response race guard, KG pagination + missing-UUID guards, backend-down error handling, and input validation (including blank statement codes).

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a minimal TypeScript demo app under demos/typescript/ that exercises the published @learning-commons/evaluators SDK end-to-end for the Math Standards Alignment evaluator, using a Vite/React frontend and an Express backend to keep API keys server-side.

Changes:

  • Introduces a Vite + React UI for selecting grade/jurisdiction/standards, entering a word problem, and viewing raw evaluator JSON output.
  • Adds an Express API server with endpoints for jurisdictions, standards lookup (via Knowledge Graph REST), and evaluation via MathStandardsAlignmentEvaluator.
  • Includes spec/plan/tasks docs and a README for setup and local running.

Reviewed changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
demos/typescript/vite.config.ts Adds Vite dev-server proxy for /api to the Express backend.
demos/typescript/tsconfig.json Adds demo-local TypeScript config for client + server code.
demos/typescript/tasks.md Tracks implementation tasks and verification notes for the demo.
demos/typescript/src/main.tsx React entrypoint mounting the demo app.
demos/typescript/src/App.tsx Main UI and client-side API calls for the demo flow.
demos/typescript/src/App.css Minimal styling for the demo UI.
demos/typescript/spec.md Defines the demo requirements and API behavior.
demos/typescript/server/kg.ts Implements Knowledge Graph REST helpers for listing standards.
demos/typescript/server/index.ts Implements Express endpoints and evaluator invocation.
demos/typescript/README.md Documents setup, required keys, and how to run locally.
demos/typescript/plan.md Documents demo structure and key design decisions.
demos/typescript/package.json Adds demo package manifest and scripts (dev/typecheck).
demos/typescript/package-lock.json Locks demo dependencies for reproducible installs.
demos/typescript/index.html Vite HTML shell for the React app.
demos/typescript/.gitignore Ignores build output, deps, and .env for the demo.
demos/typescript/.env.example Documents required environment variables for the backend.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread demos/typescript/server/index.ts Outdated
Comment thread demos/typescript/server/kg.ts
Comment thread demos/typescript/src/App.tsx Outdated
Comment thread demos/typescript/server/index.ts Outdated
@adnanrhussain adnanrhussain changed the title Add TypeScript SDK demo app (Math Standards Alignment) feat: add TypeScript SDK demo app for Math Standards Alignment Jul 16, 2026
@adnanrhussain
adnanrhussain requested a review from Copilot July 16, 2026 19:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 23 out of 24 changed files in this pull request and generated 2 comments.

Comment thread demos/typescript/src/api.ts
Comment thread demos/typescript/server/math-standards-alignment.ts
@adnanrhussain
adnanrhussain force-pushed the worktree-ahussain+ts_sdk_demo_app branch from 304e3de to cdbd4c6 Compare July 16, 2026 19:46
@adnanrhussain
adnanrhussain marked this pull request as ready for review July 16, 2026 19:54
@adnanrhussain adnanrhussain changed the title feat: add TypeScript SDK demo app for Math Standards Alignment feat: add TypeScript SDK demo app scaffold and Math Standards Alignment evaluator Jul 16, 2026
@adnanrhussain
adnanrhussain requested review from a team and czi-fsisenda July 16, 2026 19:56

@czi-fsisenda czi-fsisenda left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!
Should the plan, spec, tasks files be checked in?

@@ -0,0 +1,5 @@
# Anthropic API key
ANTHROPIC_API_KEY=sk-ant-...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: should have quotes

@adnanrhussain

Copy link
Copy Markdown
Contributor Author

Should the plan, spec, tasks files be checked in?
@czi-fsisenda - Yes, I am moving towards spec-driven development for these smaller scoped features to test iteration. May expand this approach to the larger repo. If you want a download I adapted the workflow and tooling, happy to share.

@adnanrhussain
adnanrhussain force-pushed the worktree-ahussain+ts_sdk_demo_app branch from cdbd4c6 to 2f04697 Compare July 23, 2026 21:03
@adnanrhussain
adnanrhussain merged commit b82fd2c into main Jul 23, 2026
6 checks passed
@adnanrhussain
adnanrhussain deleted the worktree-ahussain+ts_sdk_demo_app branch July 23, 2026 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants